<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<!--Converted with LaTeX2HTML 96.1 (Feb 5, 1996) by Nikos Drakos (nikos@cbl.leeds.ac.uk), CBLU, University of Leeds -->


<title>Humble Numbers</title>
<meta name="description" content="Humble Numbers">
<meta name="keywords" content="htmlatex">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<link rel="STYLESHEET" href="acm-00443_archivos/htmlatex.css">
</head><body bgcolor="#ffffff" lang="EN">
 <h1><br clear="all"><center><table bgcolor="#0060f0"><tbody><tr><td><b><font color="#c0ffff" size="5">&nbsp;<a name="SECTION0001000000000000000000">Humble Numbers</a></font>&nbsp;</b></td></tr></tbody></table></center></h1>
<p>
A number whose only prime factors are 2,3,5 or 7 is called a <em>humble</em> number. The sequence 1, 2, 3,
4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first 20 humble numbers.
</p><p>
</p><p>
Write a program to find and print the <i>n</i>th element in this sequence.
</p><p>
</p><h2><font color="#0070e8"><a name="SECTION0001001000000000000000">Input Specification</a></font></h2>
<p>
The input consists of one or more test cases. Each test case consists of one integer <i>n</i> with  <img alt="tex2html_wrap_inline35" src="acm-00443_archivos/443img1.gif" align="middle" height="25" width="99"> . Input is terminated by a value of zero (0) for <i>n</i>.
</p><p>
</p><h2><font color="#0070e8"><a name="SECTION0001002000000000000000">Output Specification</a></font></h2>
<p>
For each test case, print one line saying "<tt>The <i>n</i>th humble number is <i>number</i>.</tt>". Depending on the
value of <i>n</i>, the correct suffix "<tt>st</tt>", "<tt>nd</tt>", "<tt>rd</tt>", or "<tt>th</tt>" for the ordinal number <i>n</i>th has to be used like it is shown in the sample output.
</p><p>
</p><h2><font color="#0070e8"><a name="SECTION0001003000000000000000">Sample Input</a></font></h2>
<p>
</p><pre>1
2
3
4
11
12
13
21
22
23
100
1000
5842
0</pre>
<p>
</p><h2><font color="#0070e8"><a name="SECTION0001004000000000000000">Sample Output</a></font></h2>
<p>
</p><pre>The 1st humble number is 1.
The 2nd humble number is 2.
The 3rd humble number is 3.
The 4th humble number is 4.
The 11th humble number is 12.
The 12th humble number is 14.
The 13th humble number is 15.
The 21st humble number is 28.
The 22nd humble number is 30.
The 23rd humble number is 32.
The 100th humble number is 450.
The 1000th humble number is 385875.
The 5842nd humble number is 2000000000.</pre>
<p>
</p></body></html>